import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import moment from 'moment';

export const columns: BasicColumn[] = [
  {
    title: '定义编号',
    dataIndex: 'id',
  },
  {
    title: '流程名称',
    dataIndex: 'name',
  },
  {
    title: '定义分类',
    dataIndex: 'category',
  },
  {
    title: '表单信息',
    dataIndex: 'remark',
    slots: { customRender: 'fromInfo' },
  },
  {
    title: '流程版本',
    dataIndex: 'version',
    customRender: ({ record }) => {
      const version = record.version ? "V" + record.version : '未部署';
      return version;
    },
  },
  {
    title: '状态',
    dataIndex: 'suspensionState',
    customRender: ({ record }) => {
      const suspensionState = record.suspensionState==1 ? '激活' : '挂起';
      return suspensionState;
    },
  },
  {
    title: '部署时间',
    dataIndex: 'deploymentTime',
    customRender: ({ record }) => {
      const time = record.deploymentTime
      ;
      return time ? moment(time).format('YYYY-MM-DD') : '-';
    },
  },
  {
    title: '定义描述',
    dataIndex: 'description',
  },

];

export const searchFormSchema: FormSchema[] = [];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '岗位名称',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入岗位名称',
    },
  },
  {
    field: 'code',
    label: '岗位编码',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入岗位编码',
    },
  },
  {
    field: 'status',
    label: '状态',
    defaultValue: 0,
    component: 'Switch',
    colProps: { span: 8 },
    required: true,
    componentProps: {
      checkedValue: 1,
      unCheckedValue: 0
    }
  },
  {
    field: 'sort',
    label: '序号',
    component: 'Input',
    required: true,
    defaultValue: '255',
    componentProps: {
      placeholder: '请输入岗位序号',
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入备注',
    },
  },
];
